package com.senlingspace.web.controller.headquarters;

import com.senlingspace.common.core.controller.BaseController;
import com.senlingspace.common.core.domain.AjaxResult;
import com.senlingspace.common.core.page.TableDataInfo;
import com.senlingspace.system.domain.SlkjShopInvestor;
import com.senlingspace.system.domain.vo.*;
import com.senlingspace.system.service.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.*;

/**
 * 项目分账设置 /project/shares
 *
 * @author wangliang
 */
@RestController
@RequestMapping("/system/shares/project")
public class SlkjSharesController  extends BaseController {



    @Autowired
    private ISlkjShopInvestorService slkjShopInvestorService;
    @Autowired
    private ISlkjShopProjectFzService projectFzService;
    @Autowired
    private ISlkjShopPosService shopPosService;
    @Autowired
    private ISlkjShopOperateService operateService;

    @PreAuthorize("@ss.hasPermi('system:sharesproject:list')")
    @GetMapping("/list")
    public AjaxResult list(Long shopId){
        HashMap<String, Object> map = new HashMap<>();
        ArrayList<SharesPosVo> posList = new ArrayList<SharesPosVo>();
        ArrayList<ShopOperateVo> operateList = new ArrayList<ShopOperateVo>();
        List<SharesInvestorVo> investorList = slkjShopInvestorService.selectInvestorShopByShopId(shopId);
        List<SharesProjectVo> projectList =  projectFzService.selectProjectShopByShopId(shopId);
        SharesPosVo pos =  shopPosService.selectPosShopByShopId(shopId);
        ShopOperateVo operate = operateService.selectOperateShopByShopId(shopId);
        operateList.add(operate);
        posList.add(pos);
        map.put("investorList",investorList);
        map.put("projectList",projectList);
        map.put("pos",posList);
        map.put("operate",operateList);
        return success(map);

    }



}
